//
//  SPIsLoginViewController.m
//  Sport
//
//  Created by tikpen on 2018/4/30.
//  Copyright © 2018年 Cass. All rights reserved.
//

#import "SPIsLoginViewController.h"
#import "SPLoginViewController.h"
#import "SPTabBarController.h"

@interface SPIsLoginViewController ()
@property (nonatomic, assign) BOOL isLogin;
@end

@implementation SPIsLoginViewController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
     _isLogin = [userDefaults boolForKey:@"isLogin"];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    if (_isLogin) {
        SPTabBarController *tabbarVC = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:NSStringFromClass([SPTabBarController class])];
        [self presentViewController:tabbarVC animated:YES completion:nil];
    }else{
        SPLoginViewController *loginVC = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:NSStringFromClass([SPLoginViewController class])];
        [self presentViewController:loginVC animated:YES completion:nil];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
